<template>
  <div class="reportFormPage horizontal-border">
    <div class="report-dom horizontal">
      <el-row>
        <el-col :span="5" :offset="19">
          <div class="pageNumBox">
            <span>第</span>
            <span class="placeholder-min text-center">&nbsp;{{ form.page }}&nbsp;</span>
            <span>页，共</span>
            <span class="placeholder-min text-center">&nbsp;{{ form.totalPage }}&nbsp;</span>
            <span>页</span>
          </div>
        </el-col>
      </el-row>
      <div class="topTwoBox">
        <div class="centerName">路基路面厚度测试试验检测报告</div>
        <div class="codeText">
          <tr>BGLP01005F</tr>
        </div>
      </div>
      <div class="threeTopBox">
        <div class="left-border">
          <div class="box-title">检测单位名称：</div>
          <div class>{{ form.jiancdwmc }}</div>
        </div>
        <div class="right-border">
          <span>报告编号：</span>
          <span class="placeholder">{{ form.baogbh }}</span>
        </div>
      </div>
      <div class="table-border">
        <!-- .........................1111111111111111111111111111111......................................................... -->
        <table height="120px" class="top-table">
          <tbody>
            <tr>
              <td height="30" align="center" width="15%">
                <span style="width:90px;display:inline-block">施工/委托单位</span>
              </td>
              <td width="35%" bgcolor="#ffffff">
                <span>{{ form.shigwtdw }}</span>
              </td>
              <td align="center" width="15%">
                <span style="width:90px;display:inline-block">工程名称</span>
              </td>
              <td bgcolor="#ffffff" width="35%">
                <span>{{ form.gongcmc }}</span>
              </td>
            </tr>
            <tr>
              <td height="30" align="center" width="15%">
                <span style="width:90px;display:inline-block">工程部位/用途</span>
              </td>
              <td colspan="3">
                <span>{{ form.gongcbwyt }}</span>
              </td>
            </tr>
            <tr>
              <td height="30" align="center">样品信息</td>
              <td class="specimen-border" colspan="3">
                <span>样品名称：</span>
                <span :class="{ 'placeholder': !form.yangpmc }">{{ form.yangpmc }}</span>
                <span>；样品编号：</span>
                <span :class="{ 'placeholder-long': !form.yangpbh }">{{ form.yangpbh }}</span>
                <span>；样品数量：</span>
                <span :class="{ 'placeholder': !form.yangpsl }">{{ form.yangpsl }}</span>
                <span>；样品状态：</span>
                <span :class="{ 'placeholder': !form.yangpzt }">{{ form.yangpzt }}</span>
                <span>；来样时间：</span>
                <span :class="{ 'placeholder': !form.yangpsj }">{{ form.yangpsj }}</span>
              </td>
            </tr>
            <tr>
              <td height="30" align="center" width="15%">
                <span style="width: 90px; display: inline-block">检测依据</span>
              </td>
              <td width="35%">
                <span v-if="isPdf">{{ form.jiancyj }}</span>
                <el-input v-else type="textarea" v-model="form.jiancyj" :rows="2" class="mark"
                  @dblclick.native="showBsJiancyjView" readonly />
              </td>
              <td align="center" width="15%">
                <span style="width: 90px; display: inline-block">判定依据</span>
              </td>
              <td width="35%">
                <span v-if="isPdf">{{ form.pandyj }}</span>
                <el-input v-else type="textarea" v-model="form.pandyj" :rows="2" @dblclick.native="showBsJudgeBaseView"
                  @focus="handleFocus('pandyj')" class="mark" />
              </td>
            </tr>
            <tr class="bottom-border">
              <td height="30" align="center">
                <div>主要仪器设备</div>
                <div>名称及编号</div>
              </td>
              <td colspan="3">
                <span v-if="isPdf">{{ form.zhuyyqsbmcjbh }}</span>
                <el-input v-else type="textarea" :rows="2" v-model="form.zhuyyqsbmcjbh" class="height100 width100 mark"
                  @dblclick.native="showBsInstrumentView" readonly></el-input>
              </td>
            </tr>
          </tbody>
        </table>
        <!-- .................................22222222222222222222222222222222............................................... -->
        <table height="330px" class="middle-table">
          <tbody>
            <tr height="30">
              <td>序号</td>
              <td>测点桩号</td>
              <td>测点位置</td>
              <td>实测厚度(mm)</td>
              <td>偏差(mm)</td>
              <td>序号</td>
              <td>测点桩号</td>
              <td>测点位置</td>
              <td>实测厚度(mm)</td>
              <td>偏差(mm)</td>
              <td>序号</td>
              <td>测点桩号</td>
              <td>测点位置</td>
              <td>实测厚度(mm)</td>
              <td>偏差(mm)</td>
            </tr>
            <tr height="20">
              <td>
                <el-input type="text" v-model="form.detailList[0].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[0].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[0].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[0].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[0].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[12].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[12].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[12].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[12].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[12].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[24].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[24].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[24].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[24].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[24].pianc" disabled />
              </td>
            </tr>
            <tr height="20">
              <td>
                <el-input type="text" v-model="form.detailList[1].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[1].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[1].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[1].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[1].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[13].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[13].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[13].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[13].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[13].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[25].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[25].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[25].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[25].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[25].pianc" disabled />
              </td>
            </tr>
            <tr height="20">
              <td>
                <el-input type="text" v-model="form.detailList[2].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[2].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[2].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[2].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[2].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[14].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[14].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[14].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[14].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[14].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[26].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[26].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[26].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[26].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[26].pianc" disabled />
              </td>
            </tr>
            <tr height="20">
              <td>
                <el-input type="text" v-model="form.detailList[3].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[3].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[3].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[3].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[3].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[15].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[15].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[15].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[15].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[15].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[27].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[27].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[27].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[27].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[27].pianc" disabled />
              </td>
            </tr>
            <tr height="20">
              <td>
                <el-input type="text" v-model="form.detailList[4].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[4].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[4].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[4].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[4].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[16].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[16].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[16].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[16].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[16].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[28].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[28].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[28].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[28].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[28].pianc" disabled />
              </td>
            </tr>
            <tr height="20">
              <td>
                <el-input type="text" v-model="form.detailList[5].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[5].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[5].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[5].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[5].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[17].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[17].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[17].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[17].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[17].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[29].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[29].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[29].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[29].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[29].pianc" disabled />
              </td>
            </tr>
            <tr height="20">
              <td>
                <el-input type="text" v-model="form.detailList[6].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[6].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[6].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[6].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[6].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[18].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[18].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[18].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[18].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[18].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[30].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[30].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[30].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[30].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[30].pianc" disabled />
              </td>
            </tr>
            <tr height="20">
              <td>
                <el-input type="text" v-model="form.detailList[7].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[7].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[7].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[7].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[7].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[19].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[19].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[19].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[19].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[19].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[31].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[31].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[31].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[31].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[31].pianc" disabled />
              </td>
            </tr>
            <tr height="20">
              <td>
                <el-input type="text" v-model="form.detailList[8].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[8].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[8].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[8].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[8].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[20].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[20].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[20].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[20].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[20].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[32].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[32].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[32].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[32].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[32].pianc" disabled />
              </td>
            </tr>
            <tr height="20">
              <td>
                <el-input type="text" v-model="form.detailList[9].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[9].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[9].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[9].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[9].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[21].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[21].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[21].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[21].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[21].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[33].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[33].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[33].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[33].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[33].pianc" disabled />
              </td>
            </tr>
            <tr height="20">
              <td>
                <el-input type="text" v-model="form.detailList[10].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[10].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[10].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[10].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[10].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[22].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[22].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[22].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[22].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[22].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[34].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[34].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[34].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[34].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[34].pianc" disabled />
              </td>
            </tr>
            <tr height="20">
              <td>
                <el-input type="text" v-model="form.detailList[11].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[11].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[11].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[11].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[11].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[23].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[23].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[23].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[23].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[23].pianc" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[35].xvh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[35].cedzh" disabled />
              </td>
              <td>
                <el-input type="text" v-model="form.detailList[35].cedwz" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[35].shichd" disabled />
              </td>
              <td>
                <el-input type="number" v-model="form.detailList[35].pianc" disabled />
              </td>
            </tr>
            <tr height="20">
              <td colspan="2">厚度设计值(mm)</td>
              <td colspan="2">
                <el-input type="number" v-model="form.houdsjz" disabled />
              </td>
              <td colspan="2">允许偏差(mm)</td>
              <td colspan="2">
                <el-input type="number" v-model="form.yunxpc" disabled />
              </td>
              <td colspan="2">平均值(mm)</td>
              <td colspan="2">
                <el-input type="number" v-model="form.pingjz" disabled />
              </td>
              <td colspan="2">标准差S</td>
              <td colspan="2">
                <el-input type="number" v-model="form.bzc" disabled />
              </td>
            </tr>
            <tr height="20">
              <td colspan="2">厚度代表值(mm)</td>
              <td colspan="2">
                <el-input type="number" v-model="form.houddbz" disabled />
              </td>
              <td colspan="2">检测点数</td>
              <td colspan="2">
                <el-input type="number" v-model="form.jiancds" disabled />
              </td>
              <td colspan="2">合格点数</td>
              <td colspan="2">
                <el-input type="number" v-model="form.hegds" disabled />
              </td>
              <td colspan="2">合格率(%)</td>
              <td>
                <el-input type="number" v-model="form.hegl" disabled />
              </td>
            </tr>
            <tr>
              <td colspan="15" height="60px">
                <span v-if="isPdf" class="textarea-span">{{ form.jiancjl }}</span>
                <el-input v-else type="textarea" :rows="2" v-model="form.jiancjl" @focus="handleFocus('jiancjl')"
                  @dblclick.native="getJcjl()" />
              </td>
            </tr>
          </tbody>
        </table>
        <!-- .....................................................33333333333333333................................................... -->
        <table height="60px" class="bottom-table">
          <tr>
            <td>
              <span v-if="isPdf" class="textarea-span">{{ form.fujsm }}</span>
              <el-input v-else type="textarea" :rows="2" v-model="form.fujsm" @focus="handleFocus('fujsm')" />
            </td>
          </tr>
        </table>
      </div>
      <!-- .................................44444444444............................................. -->
      <table height="22px" class="transparent">
        <tbody>
          <tr>
            <td width="10%" align="right">检测：</td>
            <td width="15%" align="left"></td>
            <td width="10%" align="right">审核：</td>
            <td width="15%" align="left"></td>
            <td width="10%" align="right">批准：</td>
            <td align="left" width="15%"></td>
            <td width="10%">日期：</td>
            <td align="left" width="15%">
              <div style="display: inline-block; margin-left: 20px">年</div>
              <div style="display: inline-block; margin-left: 20px">月</div>
              <div style="display: inline-block ;margin-left: 20px">日</div>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <bs-instrument-view ref="bsInstrumentViewRef" @select="selectInstrument"></bs-instrument-view>
    <bs-jiancyj-view ref="bsJiancyjViewRef" @select="selectJiancyj" :syType="syType"></bs-jiancyj-view>
    <bs-judge-base-view ref="bsJudgeBaseViewRef" @select="selectJudge" :syType="syType"></bs-judge-base-view>
  </div>
</template>
<script>
import { handleFocus, emptyConvert, uniqueStr, calculateMeanvalue, calculateStandardDeviation } from "@/views/reportForms/utils";
import { getHdbgBsInfo, queryJcjl } from "@/api/report_ljlm/hdbgBsInfo";
import BsJudgeBaseView from "@/views/sycs/bsJudgeBase/BsJudgeBaseView.vue";
import BsInstrumentView from "@/views/dept/bsInstrument/BsInstrumentView.vue";
import BsJiancyjView from "@/views/sycs/bsJiancyj/BsJiancyjView.vue";
import BsJudgeBaseEditView from "@/views/sycs/bsJudgeBase/BsJudgeBaseEditView.vue";
import decimal from "@/utils/big-decimal";
import Bus from "@/utils/bus";
export default {
  name: "hdbg",
  components: {
    BsJudgeBaseView,
    BsInstrumentView,
    BsJiancyjView,
    BsJudgeBaseEditView
  },
  props: {
    excelId: {
      type: [String, Number],
      default: () => ""
    },
    syType: {
      type: [String, Number],
      default: () => ""
    },
    page: {
      type: Number,
      default: () => 0
    },
    isPdf: {
      type: Boolean,
      default: () => false
    },
    printEmpty: {
      type: Boolean,
      default: () => false
    }
  },
  data () {
    return {
      params: {},
      query: {},
      detailList: [],
      // 表单参数
      form: {
        detailList: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}]
      },
      // 表单校验
      rules: {
        excelId: [{ required: true, message: "主键不能为空", trigger: "blur" }]
      }
    };
  },
  watch: {
    isPdf (newVal, oldVal) {
      this.form = { ...emptyConvert(this.form, newVal) };
    }
  },
  created () {
    this.getInfo();
  },
  mounted () {
    // 检测依据
    Bus.$on("setHdBgJiancyj", (data) => {
      const { jiancyj, jiancyjIds } = data;
      const str = jiancyj + (this.form.jiancyj ? "、" + this.form.jiancyj : "");
      const ids = jiancyjIds + (this.form.jiancyjIds ? "," + this.form.jiancyjIds : "");
      this.form.jiancyj = uniqueStr(str, "、");
      this.form.jiancyjIds = uniqueStr(ids, ",");
    });
    // 主要设备
    Bus.$on("setHdBgZhuyyqsbmcjbh", (data) => {
      const { zhuyyqsbmcjbh, shebIds } = data;
      const str = zhuyyqsbmcjbh + (this.form.zhuyyqsbmcjbh ? "、" + this.form.zhuyyqsbmcjbh : "");
      const ids = shebIds + (this.form.shebIds ? "," + this.form.shebIds : "");
      this.form.zhuyyqsbmcjbh = uniqueStr(str, "、");
      this.form.shebIds = uniqueStr(ids, ",");
    });
    // 列表数据
    Bus.$on("setHdBgData" + this.page, (data) => {
      if (!data || data.length == 0) {
        return;
      }
      data.forEach((item, index) => {
        const { shijbh, qvywz, pingjz, pianc } = item;
        this.form.detailList[index].xvh = shijbh ? index + 1 : null;
        this.form.detailList[index].cedzh = shijbh;
        this.form.detailList[index].cedwz = qvywz;
        this.form.detailList[index].shichd = pingjz;
        this.form.detailList[index].pianc = pianc;
      });
      this.$emit('getDetailList', 'hdbg');
    });
    // 传值允许偏差
    Bus.$on("setHdBgDataTop", (info) => {
      for (const key in info) {
        if (Object.prototype.hasOwnProperty.call(info, key)) {
          this.form[key] = info[key];
        }
      }
      // 计算合格点数合格率
      this.calculateHegl();
    });
    // 传值允许偏差
    Bus.$on("updateHdBgDataBottom", (info) => {
      for (const key in info) {
        if (Object.prototype.hasOwnProperty.call(info, key)) {
          this.form[key] = info[key];
        }
      }
    });
  },

  beforeDestroy () {
    // 或者你可以使用其他合适的生命周期钩子
    // 停止监听事件
    Bus.$off("setHdBgJiancyj");
    Bus.$off("setHdBgZhuyyqsbmcjbh");
    Bus.$off("setHdBgData" + this.page);
    Bus.$off("setHdBgDataTop");
    Bus.$off("updateHdBgDataBottom");
  },

  methods: {
    // 获取详情
    getInfo () {
      if (!this.excelId) {
        const { jiancdwmc, gongcmc, constructionCompany } = this.$store.state.dept.deptInfo;
        this.form.jiancdwmc = jiancdwmc;
        this.form.gongcmc = gongcmc;
        this.form.shigwtdw = constructionCompany;
        this.form.jiancjl = "检测结论：";
        this.form.fujsm = "附加声明：";
        return;
      }
      getHdbgBsInfo(this.excelId).then((response) => {
        this.form = response.data;
        if (!this.form.jiancjl) {
          this.form.jiancjl = "检测结论：";
        }
        if (!this.form.fujsm) {
          this.form.fujsm = "附加声明：";
        }
      });
    },

    // 显示检测依据列表
    showBsJiancyjView () {
      this.$refs.bsJiancyjViewRef.init(this.form.jiancyjIds);
    },
    // 检测依据选择
    selectJiancyj (info) {
      this.form.jiancyj = info.label;
      this.form.jiancyjIds = info.ids;
    },

    // 显示判定依据列表
    showBsJudgeBaseView () {
      this.$refs.bsJudgeBaseViewRef.init(this.form.pandyjIds);
    },
    // 判断依据选择
    selectJudge (info) {
       this.form.pandyjIds = info.ids;
      this.form.pandyj = info.label;
    },

    // 显示仪器列表
    showBsInstrumentView () {
      this.$refs.bsInstrumentViewRef.init(this.form.shebIds);
    },
    // 仪器选择
    selectInstrument (info) {
      this.form.zhuyyqsbmcjbh = info.label;
      this.form.shebIds = info.ids;
    },
    // 计算检测点数
    calculateBg (detailList) {
      let jiancds = 0;
      let arr = [];
      this.detailList = detailList;
      detailList.forEach((item) => {
        if (item.shichd) {
          jiancds++;
          arr.push(item.shichd);
        }
      });
      let pingjz = null;
      let bzc = null;
      if (arr.length > 1) {
        // 平均值
        pingjz = calculateMeanvalue(arr, 0);
        // 标准差
        bzc = calculateStandardDeviation(arr);
      }
      this.form.jiancds = jiancds;
      this.form.pingjz = pingjz;
      this.form.bzc = bzc;
      // 计算代表值
      this.calculateSaibz();
      this.calculateHegl();
    },
    // 代表值
    calculateSaibz () {
      // V-T*W
      // const V = this.form.pingjkyqd; // 平均值
      // const T = this.form.baozlxsza; // 保证率  没有保证率所以为0
      // const W = this.form.biaozcs; //  标准差
      // let sum = null;
      // if (V && T && W) {
      //   sum = decimal.subtract(V, decimal.multiply(T, W, 8), 1);
      // }
      this.form.houddbz = this.form.pingjz;
    },
    // 计算合格点数
    calculateHegl () {
      let jiancds = this.form.jiancds;
      let hegds = 0;
      let hegl = null;
      if (this.form.houdsjz && this.form.yunxpc) {
        const houdsjz = this.form.houdsjz;
        const yunxpc = this.form.yunxpc;
        const arr = [houdsjz, decimal.add(houdsjz, yunxpc)];
        arr.sort((a, b) => a - b); // 升序
        this.detailList.forEach((item, index) => {
          if (item.shichd && (item.shichd >= arr[0] || item.shichd <= arr[1])) {
            hegds++;
          }
        });
        hegl = decimal.divide(decimal.multiply(hegds, 100), jiancds);
      }
      this.form.hegds = hegds;
      this.form.hegl = hegl;
      this.updateHdBgDataBottom();
    },
    updateHdBgDataBottom () {
      const info = {
        houdsjz: this.form.houdsjz,
        yunxpc: this.form.yunxpc,
        pingjz: this.form.pingjz,
        bzc: this.form.bzc,
        houddbz: this.form.houddbz,
        jiancds: this.form.jiancds,
        hegds: this.form.hegds,
        hegl: this.form.hegl,
      };
      Bus.$emit('updateHdBgDataBottom', info);
    },
    // 获取检测结论
    getJcjl () {
      const form = JSON.parse(JSON.stringify(this.form));
      queryJcjl(emptyConvert(form)).then((res) => {
        const info = res.data;
        this.form.jiancjl = info.jiancjl;
      });
    },

    submitForm () {
      return this.form;
    },
    handleFocus (event) {
      handleFocus(event, this.page, this.form[event]);
    }
  }
};
</script>

<style scoped></style>
